require("../util.js");
require("../component/components.js");
require("../../jsMt/util.js");

var vm = new Vue({
    el:"#loginIndex",
    data:{
        number:"", //13 商品详情 14 拼团  15 爆款活动  16 个人商品详情 17 游记
        productId:""
    },
    mounted:function(){
        sessionStorage.clear();
        localStorage.clear();
        this.searchObject = this.getQueryStringArgs();
        this.number=this.searchObject&&this.searchObject.number;
        if(this.number==13||this.number==16||this.number==17){  //商品详情
            this.productId=this.searchObject&&this.searchObject.productId;
        }else if(this.number==14||this.number==15){  //拼团 爆款
            this.productId=this.searchObject&&this.searchObject.orderNumber;
        }
    },
    methods:{
        //后退
        getBack:function(){
            history.go(-1);
        },
        bgimg:function(url){
            url = url?url:"";
            return {
                "background-image":'url("'+url+'"),url("")'
            }
        },
        /*获取查询字符对象*/
        getQueryStringArgs: function () {
            //取得查询字符串并去掉开头的问号
            var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
                args = {},
                items = qs.length ? qs.split("&") : [],
                item = null,
                name = null,
                value = null,
                len = items.length;
            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                name = item[0];
                value = item[1];
                if (name.length) {
                    args[name] = value;
                }
            }
            return args;
        },
        getNext:function(num){
            var path="telLogin?type="+num;
            if(this.number==13||this.number==14||this.number==15||this.number==16||this.number==17){
                path+="&number="+this.number+"&productId="+this.productId;
            }
            location.href=path;
        }
    }
});